USE [texchange_db]
GO

/****** Object:  UserDefinedFunction [dbo].[Fn_GetPageByName]    Script Date: 05/29/2011 19:58:08 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE FUNCTION [dbo].[Fn_GetPageByName] 
(	
	@lang_id  bigint,
	@page nvarchar(15)
	-- Add the parameters for the function here
)
RETURNS TABLE 
AS
RETURN 
(
	-- Add the SELECT statement with parameter references here
	SELECT [Pages].[id], [Pages].[page_id], [Pages].[html], [Pages].[keywords], [Pages].[language_id], [Pages].[parent_id] from [Pages]
	INNER JOIN PageType ON [Pages].[page_id]=[PageType].[id]
	WHERE language_id = @lang_id AND [PageType].[name]=@page
)

GO


